package com.qing.service.impl;

import com.qing.domain.News;
import com.qing.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qing.dao.*;

import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {

    private final NewsDao newsDao;

    @Autowired
    public NewsServiceImpl(NewsDao newsDao){this.newsDao=newsDao;}

    @Override
    public void addNews(News news){ newsDao.addNews(news);}
    public void deleteNewsByName(String newsName){ newsDao.deleteNewsByName(newsName);}
    public List<News> getAllNews(){return newsDao.getAllNews();}
    public News getNewsById(int newsId){return newsDao.getNewsById(newsId);}
}
